package gui;

/* unimaner - University Manager - is a program to manage your time at university.

Copyright (C) 2009 Florian Wittmann

    This file is part of Unimaner.

    Unimaner is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    Unimaner is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with Unimaner.  If not, see <http://www.gnu.org/licenses/>.
*/

import java.awt.*;
import java.awt.event.*;

import javax.swing.*;

public class MainWindow extends JFrame{

	JMenuBar menuBar;
	JMenu menuFile;
	JMenuItem menuFileNew;
	JMenuItem menuFileOpen;
	JMenuItem menuFileSave;
	JMenuItem menuFileExit;
	JMenu menuInfo;
	JMenuItem menuInfoAbout;
	
	JPanel timetable;
	
    public MainWindow() {
        initComponents();
		pack();
		setLocationRelativeTo(null);
		setVisible(true);
    }


    private void initComponents() {
    	
		//################################################
		//	Mainwindow									 #
		//################################################
        this.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        this.setPreferredSize(new Dimension(750,600));
        this.setTitle("Unimaner");
        this.addWindowListener(new mainWindowListener());

        
		//################################################
		//	Timetable									 #
		//################################################
        
        timetable = new JPanel();
        this.add(timetable);       
        
		//################################################
		//	Menue										 #
		//################################################
        
        menuBar = new JMenuBar();
        this.setJMenuBar(menuBar);
        
        menuFile = new JMenu("Datei");
        menuBar.add(menuFile);
        
        menuFileNew = new JMenuItem("Neu");
        menuFileNew.addActionListener(new ActionListener() {
    		@Override
    		public void actionPerformed(ActionEvent e) {
    			//TODO
    		}
        });
        menuFile.add(menuFileNew);
        
        menuFileOpen = new JMenuItem("Laden");
        menuFileOpen.addActionListener(new ActionListener() {
    		@Override
    		public void actionPerformed(ActionEvent e) {
    			//TODO
    		}
        });
        menuFile.add(menuFileOpen);
        
        menuFileSave = new JMenuItem("Speichern");
        menuFileSave.addActionListener(new ActionListener() {
    		@Override
    		public void actionPerformed(ActionEvent e) {
    			//TODO
    		}
        });
        menuFile.add(menuFileSave);
        
        menuFileExit = new JMenuItem("Beenden");
        menuFileExit.addActionListener(new ActionListener() {
    		@Override
    		public void actionPerformed(ActionEvent e) {
    			System.exit(0);
    			
    		}
        });
        menuFile.add(menuFileExit);
        
        menuInfo = new JMenu("Info");
        menuBar.add(menuInfo);
        
        menuInfoAbout = new JMenuItem("About");
        menuInfoAbout.addActionListener(new ActionListener() {
        	@Override
			public void actionPerformed(ActionEvent e) {
				new DialogWindow("Unimaner","");
			}
		});
        menuInfo.add(menuInfoAbout);
        
        
        
    }
    
     
    public class mainWindowListener implements WindowListener {

		@Override
		public void windowClosing(WindowEvent e) {
			System.exit(0);
			
		}
		public void windowActivated(WindowEvent e) {}
		public void windowDeactivated(WindowEvent e) {}
		public void windowDeiconified(WindowEvent e) {}
		public void windowIconified(WindowEvent e) {}
		public void windowOpened(WindowEvent e) {}
		public void windowClosed(WindowEvent e) {}
    }
    
}
